/**
 * 
 */
package ar.com.personalTravellers.generators.columns;

import java.util.HashMap;
import java.util.Map;

import ar.com.personalTravellers.rowProcessors.FlexInternationalizationRowProcessorCommand;

import com.angel.io.factories.FileColumnsFactory;

/**
 * @author William
 *
 */
public class LanguagesFileColumnsFactory implements FileColumnsFactory {
	private Integer currentPosition = 0;

	private Map<String, Integer> columns = new HashMap<String, Integer>();

	public String getColumnNameAt(Integer position) {
		for(String columnName: this.columns.keySet()){
			if(this.columns.get(columnName) == position){
				return columnName;
			}
		}
		return null;
	}

	public Integer getColumnQuantity() {
		return this.columns.size();
	}

	public Integer getCurrentPosition() {
		return this.currentPosition;
	}

	public String getNextColumnName() {
		for(String columnName: this.columns.keySet()){
			if(this.columns.get(columnName) == this.getCurrentPosition()){
				this.currentPosition++;
				return columnName;
			}
		}
		return null;
	}

	public boolean hasMoreColumns() {
		return this.getColumnQuantity() > this.getCurrentPosition();
	}

	public void initialize() {
		columns.put(FlexInternationalizationRowProcessorCommand.KEY_COLUMN              ,0);
        columns.put(FlexInternationalizationRowProcessorCommand.SPANISH_VALUE_COLUMN	,1);
        columns.put(FlexInternationalizationRowProcessorCommand.ENGLISH_VALUE_COLUMN    ,2);
        columns.put(FlexInternationalizationRowProcessorCommand.FRENCH_VALUE_COLUMN     ,3);
        columns.put(FlexInternationalizationRowProcessorCommand.CHECO_VALUE_COLUMN      ,4);
        columns.put(FlexInternationalizationRowProcessorCommand.GERMAN_VALUE_COLUMN     ,5);
        columns.put(FlexInternationalizationRowProcessorCommand.PORTUGUES_VALUE_COLUMN  ,6);
	}
}
